
  ___  ____  ____  ____  ____ ®
 /__    /   ____/   /   ____/      18.0
___/   /   /___/   /   /___/       MP—Parallel Edition

 Statistics and Data Science       Copyright 1985-2023 StataCorp LLC
                                   StataCorp
                                   4905 Lakeway Drive
                                   College Station, Texas 77845 USA
                                   800-STATA-PC        https://www.stata.com
                                   979-696-4600        stata@stata.com

Stata license: 22-user 8-core network, expiring 30 Jun 2025
Serial number: 501809309427
  Licensed to: The University of Chicago Booth School of Business
               Mercury Computing Cluster

Notes:
      1. Stata is running in batch mode.
      2. Unicode is supported; see help unicode_advice.
      3. More than 2 billion observations are allowed; see help obs_advice.
      4. Maximum number of variables is set to 5,000 but can be increased;
          see help set_maxvar.

. do "/project/fagoolsb/git/service_industries/replication_package/exhibits/1_t
> ables_and_figures.do" 

. * Author: Joe Tatarka
. * Name: 1_tables_and_figures.do
. * Last Updated Date: June 26, 2025
. * Purpose: Recreate the tables and figures for "The Curious Surge of Producti
> vity in U.S. Restaurants" NBER Working Paper
. 
. * Set Global File Paths
. global data_root = "/project/fagoolsb/service_industries/replication_package/
> datasets/built"

. global export_root = "/project/fagoolsb/service_industries/replication_packag
> e/exhibits"

. 
. *****************************************************************************
> ***
. *** Figure 1 - Real Sales per Emp, Food Services and Drinking Places, Seasona
> lly Adjusted
. *****************************************************************************
> ***
. *** In the paper we put the excel graph, but I am recreating it with Stata
. use "${data_root}/aggregates_build.dta", clear 

. 
. graph twoway line prod_food_sa_idx1992 year_month_gs, ytitle("") yline(100, l
> color(black) lwidth(thin)) ylabel(70(10)130) xlabel(384(48)780)

. graph export "${export_root}/figure_1.pdf", replace
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > 1.pdf saved as PDF format

. 
. *****************************************************************************
> ***
. *** Figure 2 - Compare Cenus/BLS Sales and Employees to SafeGraph
. *****************************************************************************
> ***
. use "${data_root}/aggregates_build.dta", clear 

. 
. keep if year_month_gs >= monthly("jan2019", "MY") & year_month_gs <= monthly(
> "dec2022", "MY")
(348 observations deleted)

. 
. sum spend_sg_idx2019

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
spend_s~2019 |         48    105.3469    10.48671   77.37409   122.9059

. gen high = r(max)

. sum emp_sg_idx2019

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
emp_sg_~2019 |         48    97.98459    12.31385   59.37445   118.4945

. gen low = r(min)

. 
. label var spend_limited_idx2019 "Census Sales"

. label var spend_sg_idx2019 "SafeGraph Sales"

. label var emp_limited_idx2019 "BLS Employees"

. label var emp_sg_idx2019 "SafeGraph Employees"

. 
. *** Figure 2a
. graph twoway line spend_limited_idx2019 year_month_gs, lcolor(stc1) lwidth(th
> ick) || line spend_sg_idx2019 year_month_gs, lcolor(stc2) title("") subtitle(
> "") ytitle("") legend(order(1 2) cols(2) position(6)) yline(100, lcolor(black
> ) lwidth(thin)) xscale(range(708 758)) ylabel(60(10)120)

. graph export "${export_root}/figure_2a.pdf", replace 
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > 2a.pdf saved as PDF format

. 
. *** Figure 2b
. graph twoway rarea high low year_month_gs if year_month_gs >= 748, lcolor(gs1
> 4%0) fcolor(gs14%50) || line emp_limited_idx2019 year_month_gs, lcolor(stc1) 
> lwidth(thick) || line emp_sg_idx2019 year_month_gs if year_month_gs <= 747, l
> color(stc2) || line emp_sg_idx2019 year_month_gs if year_month_gs >= 748 , lc
> olor(stc2) title("") subtitle("") ytitle("") legend(order(2 3) cols(2) positi
> on(6)) yline(100, lcolor(black) lwidth(thin)) xscale(range(708 758)) ylabel(6
> 0(10)120)

. graph export "${export_root}/figure_2b.pdf", replace 
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > 2b.pdf saved as PDF format

. 
. *****************************************************************************
> ****
. **** Figure 3, Average SafeGraph Employment per Restaurant 
. *****************************************************************************
> ****
. use "${data_root}/main_build.dta", clear

. 
. * Take monthly average of employment measure 
. collapse (mean) spend visits emp, by(year_month_gs)

. label var year_month_gs "Year-Month"

. 
. ** create index to avg 2019 
. sort year_month_gs

. foreach var in "spend" "visits" "emp" {
  2.         egen `var'_2019 = mean(`var') if year_month_gs <= monthly("dec2019
> ", "MY")
  3.         gen `var'_index = 100*(`var'/`var'_2019[1])
  4. }
(36 missing values generated)
(36 missing values generated)
(36 missing values generated)

. 
. label var emp_index "Average Employee Shifts"

. 
. gen high =  120

. gen low = 60

. graph twoway rarea high low year_month_gs if year_month_gs >= 748, lcolor(gs1
> 4%0) fcolor(gs14%50) || line emp_index year_month_gs if year_month_gs <=747, 
> lcolor(stc1) || line emp_index year_month_gs if year_month_gs >= 748, lcolor(
> stc1) ytitle("") legend(off) yline(100, lcolor(black) lwidth(thin)) xscale(ra
> nge(708 758)) ylabel(60(10)120) 

. graph export "${export_root}/figure_3.pdf", replace
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > 3.pdf saved as PDF format

. 
. *****************************************************************************
> ***
. **** Figure 4, Average Customer Dwell Time Visit Shares
. *****************************************************************************
> ***
. use "${data_root}/main_build.dta", clear

. 
. ** Take Monthly Average of Dwell Shares
. collapse (mean) dwell_0_to_10_share dwell_11_to_20_share dwell_21_to_60_share
>  dwell_61_to_240_share, by(year_month_gs)

. 
. label var dwell_0_to_10_share "0-10 Minutes"

. label var dwell_11_to_20_share "11-20 Minutes"

. label var dwell_21_to_60_share "21-60 Minutes"

. label var dwell_61_to_240_share "61-240 Minutes"

. label var year_month_gs "Year-Month"

. 
. gen high = 0.7

. gen low = 0

. 
. graph twoway rarea high low year_month_gs if year_month_gs >=748, lcolor(gs14
> %0) fcolor(gs14%50) || line dwell_0_to_10_share year_month_gs if year_month_g
> s <= 747, lcolor(stc1) || line dwell_0_to_10_share year_month_gs if year_mont
> h_gs >= 748, lcolor(stc1) || line dwell_11_to_20_share year_month_gs if year_
> month_gs <= 747, lcolor(stc2) || line dwell_11_to_20_share year_month_gs if y
> ear_month_gs >= 748, lcolor(stc2) || line dwell_21_to_60_share year_month_gs 
> if year_month_gs <= 747, lcolor(stc3) || line dwell_21_to_60_share year_month
> _gs if year_month_gs >= 748, lcolor(stc3) || line dwell_61_to_240_share year_
> month_gs if year_month_gs <= 747, lcolor(stc4) || line dwell_61_to_240_share 
> year_month_gs if year_month_gs >= 748, lcolor(stc4) title("") ytitle("Share o
> f Visits") ylabel(0(0.1)0.7, format(%3.1fc)) legend(order(2 4 6 8) cols(2) po
> sition(6))  xscale(range(708 758)) 

. graph export "${export_root}/figure_4.pdf", replace 
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > 4.pdf saved as PDF format

. 
. *****************************************************************************
> ***
. **** Table 1, Table A1, Figure A4, Figure A5, Figure A6
. **** Dwell Time Changes and Productivity Regressions 
. *****************************************************************************
> ***
. *** Easier to make all of these tables and figures in one fell swoop
. use "${data_root}/main_build.dta", clear

. 
. *** Shorten Brand Names
. replace brands = "Domino's" if brands == "Domino's Pizza"
(254,312 real changes made)

. replace brands = "Chipotle" if brands == "Chipotle Mexican Grill"
(111,568 real changes made)

. 
. *** Create Indicator Variables for all brands + entire sample
. gen brands_1 = 1

. label var brands_1 "All Restaurants"

. local i = 2

. foreach brands in  "McDonald's" "Chick-fil-A" "Taco Bell" "Wendy's" "Burger K
> ing" "Starbucks" "Dunkin'" "Subway" "Chipotle" "Domino's" "Pizza Hut"  {
  2.         gen brands_`i' = (brands == "`brands'")
  3.         label var brands_`i' "`brands'"
  4.         local i = `i' + 1
  5. }

. 
. *** Create frame with the change in avg dwell shares 
. *** create like 48 vars of dwell share * brand dummy and then collapse to yea
> r_month 
. *** Use this same frame throughout the mega loop
. 
. frame copy default new, replace
(note: frame new not found)

. 
. frame new {
.         foreach var of varlist brands_1-brands_12 {
  2.                 foreach dwell_var of varlist dwell_0_to_10_share dwell_11_
> to_20_share dwell_21_to_60_share dwell_61_to_240_share {
  3.                         gen `var'_`dwell_var' = `dwell_var' if `var' == 1
  4.                 }
  5.         }
(5,133,473 missing values generated)
(5,133,473 missing values generated)
(5,133,473 missing values generated)
(5,133,473 missing values generated)
(5,625,899 missing values generated)
(5,625,899 missing values generated)
(5,625,899 missing values generated)
(5,625,899 missing values generated)
(5,461,283 missing values generated)
(5,461,283 missing values generated)
(5,461,283 missing values generated)
(5,461,283 missing values generated)
(5,487,180 missing values generated)
(5,487,180 missing values generated)
(5,487,180 missing values generated)
(5,487,180 missing values generated)
(5,480,633 missing values generated)
(5,480,633 missing values generated)
(5,480,633 missing values generated)
(5,480,633 missing values generated)
(5,366,082 missing values generated)
(5,366,082 missing values generated)
(5,366,082 missing values generated)
(5,366,082 missing values generated)
(5,398,214 missing values generated)
(5,398,214 missing values generated)
(5,398,214 missing values generated)
(5,398,214 missing values generated)
(5,146,199 missing values generated)
(5,146,199 missing values generated)
(5,146,199 missing values generated)
(5,146,199 missing values generated)
(5,602,858 missing values generated)
(5,602,858 missing values generated)
(5,602,858 missing values generated)
(5,602,858 missing values generated)
(5,460,114 missing values generated)
(5,460,114 missing values generated)
(5,460,114 missing values generated)
(5,460,114 missing values generated)
(5,554,795 missing values generated)
(5,554,795 missing values generated)
(5,554,795 missing values generated)
(5,554,795 missing values generated)
.         
.         collapse (mean) brands_1_dwell_0_to_10_share - brands_12_dwell_61_to_
> 240_share, by(year_month_gs)
. }

. 
. label var dwell_0_to_10_share "0-10 Minutes"

. label var dwell_11_to_20_share "11-20 Minutes"

. label var dwell_21_to_60_share "21-60 Minutes"

. 
. **** REGRESSION TIME 
. ** Loop through and run regression for each restaurant chain + entire sample
. ** Basically: run regression, multiply regression coefficients by the change 
> in dwell shares to create implied productivity change, and then continue to n
> ext restaurant chain
. est clear

. foreach num of numlist 1/12 {
  2.         local reg_title_`num': var label brands_`num'
  3.         * regression
.         quietly: eststo, title("`reg_title_`num''"): reghdfe ln_spend_prod dw
> ell_0_to_10_share dwell_11_to_20_share dwell_21_to_60_share if brands_`num' =
> = 1, absorb(placekey year_month_gs) vce(cluster placekey)
  4.                 
.         frame change new 
  5.         gen brands_`num'_diff = 0
  6.         gen brands_`num'_lb = 0 
  7.         gen brands_`num'_ub = 0
  8.         
.         foreach dwell in "dwell_0_to_10" "dwell_11_to_20" "dwell_21_to_60" "d
> well_61_to_240" {
  9.                 quietly: sum brands_`num'_`dwell'_share if year_month_gs <
> = monthly("dec2019", "MY")
 10.                 local `dwell'_2019 = r(mean)
 11.         }
 12.         
.         quietly: foreach n of numlist 1(1)48 {
 13.                 local 0_10_diff = brands_`num'_dwell_0_to_10_share[`n'] - 
> `dwell_0_to_10_2019'
 14.                 local 11_20_diff = brands_`num'_dwell_11_to_20_share[`n'] 
> - `dwell_11_to_20_2019' 
 15.                 local 21_60_diff = brands_`num'_dwell_21_to_60_share[`n'] 
> - `dwell_21_to_60_2019'
 16.         
.                 * Multiply coefficients by change from 2019 avg
.                 lincom `0_10_diff'*dwell_0_to_10_share + `11_20_diff'*dwell_1
> 1_to_20_share + `21_60_diff'*dwell_21_to_60_share
 17.                 replace brands_`num'_diff = r(estimate) if _n == `n'
 18.                 replace brands_`num'_lb = r(lb) if _n == `n'
 19.                 replace brands_`num'_ub = r(ub) if _n == `n'
 20.         }
 21. 
.         *** Estadd Some Locals (Change from 2019 avg to April 2022)
.         foreach dwell in "dwell_0_to_10" "dwell_11_to_20" "dwell_21_to_60" "d
> well_61_to_240" {
 22.                 estadd scalar `dwell'_change = brands_`num'_`dwell'_share[
> 40] - ``dwell'_2019'
 23.         }
 24.         estadd scalar projected_prod =  100*brands_`num'_diff[40]
 25.         
.         frame change default 
 26.         
. }

added scalar:
e(dwell_0_to_10_change) =  .08105503

added scalar:
e(dwell_11_to_20_change) =  -.02310383

added scalar:
e(dwell_21_to_60_change) =  -.04482081

added scalar:
e(dwell_61_to_240_change) =  -.01313038

added scalar:
     e(projected_prod) =  11.267336

added scalar:
e(dwell_0_to_10_change) =  .09883659

added scalar:
e(dwell_11_to_20_change) =  -.0129367

added scalar:
e(dwell_21_to_60_change) =  -.06253728

added scalar:
e(dwell_61_to_240_change) =  -.0233626

added scalar:
     e(projected_prod) =  22.363538

added scalar:
e(dwell_0_to_10_change) =  .08814804

added scalar:
e(dwell_11_to_20_change) =  .00443633

added scalar:
e(dwell_21_to_60_change) =  -.07971024

added scalar:
e(dwell_61_to_240_change) =  -.01287411

added scalar:
     e(projected_prod) =  14.178148

added scalar:
e(dwell_0_to_10_change) =  .10378881

added scalar:
e(dwell_11_to_20_change) =  -.02704672

added scalar:
e(dwell_21_to_60_change) =  -.06474116

added scalar:
e(dwell_61_to_240_change) =  -.01200096

added scalar:
     e(projected_prod) =  19.44139

added scalar:
e(dwell_0_to_10_change) =  .12116447

added scalar:
e(dwell_11_to_20_change) =  -.01913994

added scalar:
e(dwell_21_to_60_change) =  -.0861452

added scalar:
e(dwell_61_to_240_change) =  -.01587935

added scalar:
     e(projected_prod) =  22.385374

added scalar:
e(dwell_0_to_10_change) =  .11575441

added scalar:
e(dwell_11_to_20_change) =  -.02560107

added scalar:
e(dwell_21_to_60_change) =  -.07132115

added scalar:
e(dwell_61_to_240_change) =  -.01883219

added scalar:
     e(projected_prod) =  22.814026

added scalar:
e(dwell_0_to_10_change) =  .09125125

added scalar:
e(dwell_11_to_20_change) =  -.01031001

added scalar:
e(dwell_21_to_60_change) =  -.04531401

added scalar:
e(dwell_61_to_240_change) =  -.03562722

added scalar:
     e(projected_prod) =  22.037822

added scalar:
e(dwell_0_to_10_change) =  .08406928

added scalar:
e(dwell_11_to_20_change) =  -.02092761

added scalar:
e(dwell_21_to_60_change) =  -.03621452

added scalar:
e(dwell_61_to_240_change) =  -.02692713

added scalar:
     e(projected_prod) =  19.667013

added scalar:
e(dwell_0_to_10_change) =  .06848093

added scalar:
e(dwell_11_to_20_change) =  -.03585238

added scalar:
e(dwell_21_to_60_change) =  -.0262796

added scalar:
e(dwell_61_to_240_change) =  -.00634896

added scalar:
     e(projected_prod) =  6.0128462

added scalar:
e(dwell_0_to_10_change) =  .06472612

added scalar:
e(dwell_11_to_20_change) =  -.02904172

added scalar:
e(dwell_21_to_60_change) =  -.03348103

added scalar:
e(dwell_61_to_240_change) =  -.00220337

added scalar:
     e(projected_prod) =  7.8634955

added scalar:
e(dwell_0_to_10_change) =  .05028691

added scalar:
e(dwell_11_to_20_change) =  -.03207269

added scalar:
e(dwell_21_to_60_change) =  -.01386967

added scalar:
e(dwell_61_to_240_change) =  -.00434455

added scalar:
     e(projected_prod) =  4.3639015

added scalar:
e(dwell_0_to_10_change) =  .07624102

added scalar:
e(dwell_11_to_20_change) =  -.02945922

added scalar:
e(dwell_21_to_60_change) =  -.05023051

added scalar:
e(dwell_61_to_240_change) =  .00344869

added scalar:
     e(projected_prod) =  1.8999999

. *** Table 1, Regression Table
. ** We do some manual editing after to make the tables look nicer for the pape
> r
. esttab est1 est2 est3 est4 est5 est6 using "${export_root}/table_1.rtf", nost
> ar onecell mtitle se noomitted nocons nobase compress stats(N r2, label("N" "
> R-Squared") fmt(%9.0fc 2)) label replace title("Table 1") nonote collabel(non
> e)
(output written to /project/fagoolsb/service_industries/replication_package/exh
> ibits/table_1.rtf)

. 
. esttab est1 est2 est3 est4 est5 est6 using "${export_root}/table_1.rtf", nost
> ar nomtitle nonum se drop(_cons dwell_0_to_10_share dwell_11_to_20_share dwel
> l_21_to_60_share) compress stats( dwell_0_to_10_change dwell_11_to_20_change 
> dwell_21_to_60_change dwell_61_to_240_change projected_prod, label("0-10 Minu
> tes" "11-20 Minutes" "21-60 Minutes" "61-240 Minutes" "Impl. Change % Product
> ivity") fmt(3 3 3 3 1)) label append  title("Average dwell time category shar
> e change from 2019 to April 2022 and implied productivity change:")
(output written to /project/fagoolsb/service_industries/replication_package/exh
> ibits/table_1.rtf)

. 
. *** Table A1, Regression Table - Additional Restaurant Chains
. ** We do some manual editing after to make the tables look nicer for the pape
> r
. esttab est7 est8 est9 est10 est11 est12 using "${export_root}/table_A1.rtf", 
> nostar onecell mtitle se noomitted nocons nobase compress stats(N r2, label("
> N" "R-Squared") fmt(%9.0fc 2)) label replace title("Table A1") nonote collabe
> l(none)
(output written to /project/fagoolsb/service_industries/replication_package/exh
> ibits/table_A1.rtf)

. 
. esttab est7 est8 est9 est10 est11 est12 using "${export_root}/table_A1.rtf", 
> nostar nomtitle nonum se drop(_cons dwell_0_to_10_share dwell_11_to_20_share 
> dwell_21_to_60_share) compress stats( dwell_0_to_10_change dwell_11_to_20_cha
> nge dwell_21_to_60_change dwell_61_to_240_change projected_prod, label("0-10 
> Minutes" "11-20 Minutes" "21-60 Minutes" "61-240 Minutes" "Impl. Change % Pro
> ductivity") fmt(3 3 3 3 1)) label append  title("Average dwell time category 
> share change from 2019 to April 2022 and implied productivity change:") 
(output written to /project/fagoolsb/service_industries/replication_package/exh
> ibits/table_A1.rtf)

. 
. 
. **** Figure A4, Productivity Projections 
. frame new {
. 
.         gen high = 0.5
.         gen low = -0.1
.         
.         foreach num of numlist 1/6 {
  2.                 label var brands_`num'_diff "`reg_title_`num''"
  3.         }
.         
.         label var year_month_gs "Year-Month"
.         graph twoway rarea high low year_month_gs if year_month_gs >= 748, lc
> olor(gs14%0) fcolor(gs14%50) || line brands_1_diff brands_2_diff brands_3_dif
> f brands_4_diff brands_5_diff brands_6_diff year_month_gs if year_month_gs <=
> 747, lcolor(black stc1 stc2 stc3 stc4 stc5) lwidth(thick) || line brands_1_di
> ff brands_2_diff brands_3_diff brands_4_diff brands_5_diff brands_6_diff year
> _month_gs if year_month_gs >=748, lcolor(black stc1 stc2 stc3 stc4 stc5) lwid
> th(thick) yline(0, lcolor(black) lwidth(thin)) title("") ylabel(-0.1(0.1)0.5,
>  format(%3.1fc)) ytitle("Productivity Difference, Log Scale") legend(order(6 
> 7 5 3 4 2)) 
.         graph export "${export_root}/figure_A4.pdf", replace
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > A4.pdf saved as PDF format
. }

. 
. **** Figure A5, Productivity Projections - Additional Restaurant Chains 
. frame new {
.         
.         foreach num of numlist 7/12 {
  2.                 label var brands_`num'_diff "`reg_title_`num''"
  3.         }
.         
.         label var year_month_gs "Year-Month"
.         graph twoway rarea high low year_month_gs if year_month_gs >= 748, lc
> olor(gs14%0) fcolor(gs14%50) || line brands_7_diff brands_8_diff brands_9_dif
> f brands_10_diff brands_11_diff brands_12_diff year_month_gs if year_month_gs
>  <=747, lcolor(stc6 stc7 stc8 stc9 stc10 stc11)  || line brands_7_diff brands
> _8_diff brands_9_diff brands_10_diff brands_11_diff brands_12_diff year_month
> _gs if year_month_gs >=748, lcolor(stc6 stc7 stc8 stc9 stc10 stc11) yline(0, 
> lcolor(black) lwidth(thin)) title("") ylabel(-0.1(0.1)0.5, format(%3.1fc)) yt
> itle("Productivity Difference, Log Scale") legend(order(2 5 3 7 6 4)) 
.         graph export "${export_root}/figure_A5.pdf", replace
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > A5.pdf saved as PDF format
. }

. 
. 
. *****************************************************************************
> **
. ***** Figure A1 - Real Sales per Emp, Food Services and Drinking Places and L
> imited Service, Not Seasonally Adjusted
. *****************************************************************************
> **
. **** Paper uses excel graph, but I recreate here in Stata
. use "${data_root}/aggregates_build.dta", clear 

. 
. label var prod_food_nsa_idx1992 "Total Industry"

. label var prod_limited_food_cpi_idx1992 "Limited Service"

. 
. graph twoway line prod_food_nsa_idx1992 prod_limited_food_cpi_idx1992 year_mo
> nth_gs, ytitle("") legend(order(1 2) cols(2) position(6)) yline(100, lcolor(b
> lack) lwidth(thin)) ylabel(80(10)140) xlabel(384(48)780) 

. graph export "${export_root}/figure_A1.pdf", replace 
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > A1.pdf saved as PDF format

. 
. *****************************************************************************
> **
. ***** Figure A2 - Compare Census/BLS Productivity to SafeGraph Productivity
. *****************************************************************************
> **
. use "${data_root}/aggregates_build.dta", clear 

. 
. keep if year_month_gs >= monthly("jan2019", "MY") & year_month_gs <= monthly(
> "dec2022", "MY")
(348 observations deleted)

. 
. gen high = 140 

. gen low = 80

. 
. label var prod_limited_idx2019 "Census/BLS Spend Productivity"

. label var prod_sg_idx2019  "SafeGraph Spend Productivity"

. label var visits_prod_sg_idx2019 "SafeGraph Visits Productivity"

. 
. graph twoway rarea high low year_month_gs if year_month_gs >=748, lcolor(gs14
> %0) fcolor(gs14%50) || line prod_limited_idx2019 year_month_gs, lcolor(stc1) 
> lwidth(thick) || line prod_sg_idx2019 year_month_gs if year_month_gs <= 747, 
> lcolor(stc2) || line prod_sg_idx2019 year_month_gs if year_month_gs >= 748, l
> color(stc2) || line visits_prod_sg_idx2019 year_month_gs if year_month_gs <= 
> 747, lcolor(stc3) || line visits_prod_sg_idx2019 year_month_gs if year_month_
> gs >= 748, lcolor(stc3) title("") subtitle("") ytitle("") legend(order(2 3 5)
>  cols(2) position(6)) yline(100, lcolor(black) lwidth(thin)) xscale(range(708
>  758))  ylabel(80(10)140)

. graph export "${export_root}/figure_A2.pdf", replace 
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > A2.pdf saved as PDF format

. 
. *****************************************************************************
> **
. **** Figure A3, Delivery and Driver App Usage, Aggregate Minutes per Day
. *****************************************************************************
> ***
. use "${data_root}/gws_build.dta", clear

. 
. label var delivery_use_per_day_idx2019 "Delivery Apps"

. label var driver_use_per_day_idx2019 "Driver Apps"

. 
. graph twoway line delivery_use_per_day_idx2019 driver_use_per_day_idx2019 yea
> r_month_gs, title("") ytitle("") yline(100, lcolor(black) lwidth(thin)) legen
> d(pos(6) col(2) label(1 "Delivery Apps") label(2 "Driver Apps")) xlabel(708(1
> 2)768) xscale(range(708 770))

. graph export "${export_root}/figure_A3.pdf", replace
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > A3.pdf saved as PDF format

. 
. *****************************************************************************
> ***
. **** Figure A6, Implied Productivity Difference from Dwell Time Changes, Prod
> uctivity Measured as Customer Visits per Employee 
. *****************************************************************************
> ***
. use "${data_root}/main_build.dta", clear

. 
. *** Shorten Brand Names
. replace brands = "Domino's" if brands == "Domino's Pizza"
(254,312 real changes made)

. replace brands = "Chipotle" if brands == "Chipotle Mexican Grill"
(111,568 real changes made)

. 
. *** Create Indicator Variables for restaurant chains + entire sample
. gen brands_1 = 1

. label var brands_1 "All Restaurants"

. local i = 2

. foreach brands in  "McDonald's" "Chick-fil-A" "Taco Bell" "Wendy's" "Burger K
> ing" "Starbucks" "Dunkin'" "Subway" "Chipotle" "Domino's" "Pizza Hut"  {
  2.         gen brands_`i' = (brands == "`brands'")
  3.         label var brands_`i' "`brands'"
  4.         local i = `i' + 1
  5. }

. 
. frame copy default new, replace

. 
. frame new {
.         foreach var of varlist brands_1-brands_12 {
  2.                 foreach dwell_var of varlist dwell_0_to_10_share dwell_11_
> to_20_share dwell_21_to_60_share dwell_61_to_240_share {
  3.                         gen `var'_`dwell_var' = `dwell_var' if `var' == 1
  4.                 }
  5.         }
(5,133,473 missing values generated)
(5,133,473 missing values generated)
(5,133,473 missing values generated)
(5,133,473 missing values generated)
(5,625,899 missing values generated)
(5,625,899 missing values generated)
(5,625,899 missing values generated)
(5,625,899 missing values generated)
(5,461,283 missing values generated)
(5,461,283 missing values generated)
(5,461,283 missing values generated)
(5,461,283 missing values generated)
(5,487,180 missing values generated)
(5,487,180 missing values generated)
(5,487,180 missing values generated)
(5,487,180 missing values generated)
(5,480,633 missing values generated)
(5,480,633 missing values generated)
(5,480,633 missing values generated)
(5,480,633 missing values generated)
(5,366,082 missing values generated)
(5,366,082 missing values generated)
(5,366,082 missing values generated)
(5,366,082 missing values generated)
(5,398,214 missing values generated)
(5,398,214 missing values generated)
(5,398,214 missing values generated)
(5,398,214 missing values generated)
(5,146,199 missing values generated)
(5,146,199 missing values generated)
(5,146,199 missing values generated)
(5,146,199 missing values generated)
(5,602,858 missing values generated)
(5,602,858 missing values generated)
(5,602,858 missing values generated)
(5,602,858 missing values generated)
(5,460,114 missing values generated)
(5,460,114 missing values generated)
(5,460,114 missing values generated)
(5,460,114 missing values generated)
(5,554,795 missing values generated)
(5,554,795 missing values generated)
(5,554,795 missing values generated)
(5,554,795 missing values generated)
.         
.         collapse (mean) brands_1_dwell_0_to_10_share - brands_12_dwell_61_to_
> 240_share, by(year_month_gs)
. }

. 
. label var dwell_0_to_10_share "0-10 Minutes"

. label var dwell_11_to_20_share "11-20 Minutes"

. label var dwell_21_to_60_share "21-60 Minutes"

. 
. **** REGRESSION TIME 
. est clear

. foreach num of numlist 1/6 {
  2.         local reg_title_`num': var label brands_`num'
  3.         quietly: eststo, title("`reg_title_`num''"): reghdfe ln_visits_pro
> d dwell_0_to_10_share dwell_11_to_20_share dwell_21_to_60_share if brands_`nu
> m' == 1, absorb(placekey year_month_gs) vce(cluster placekey)
  4.                 
.         frame change new 
  5.         
.         gen brands_`num'_diff = 0
  6.         gen brands_`num'_lb = 0 
  7.         gen brands_`num'_ub = 0
  8.         
.         foreach dwell in "dwell_0_to_10" "dwell_11_to_20" "dwell_21_to_60" "d
> well_61_to_240" {
  9.                 quietly: sum brands_`num'_`dwell'_share if year_month_gs <
> = monthly("dec2019", "MY")
 10.                 local `dwell'_2019 = r(mean)
 11.         }
 12.         
.         quietly: foreach n of numlist 1(1)48 {
 13.                 local 0_10_diff = brands_`num'_dwell_0_to_10_share[`n'] - 
> `dwell_0_to_10_2019'
 14.                 local 11_20_diff = brands_`num'_dwell_11_to_20_share[`n'] 
> - `dwell_11_to_20_2019' 
 15.                 local 21_60_diff = brands_`num'_dwell_21_to_60_share[`n'] 
> - `dwell_21_to_60_2019'
 16.         
.                 lincom `0_10_diff'*dwell_0_to_10_share + `11_20_diff'*dwell_1
> 1_to_20_share + `21_60_diff'*dwell_21_to_60_share
 17.                 replace brands_`num'_diff = r(estimate) if _n == `n'
 18.                 replace brands_`num'_lb = r(lb) if _n == `n'
 19.                 replace brands_`num'_ub = r(ub) if _n == `n'
 20.         }
 21. 
.         *** Estadd Some Locals (Change from 2019 avg to April 2022)
.         foreach dwell in "dwell_0_to_10" "dwell_11_to_20" "dwell_21_to_60" "d
> well_61_to_240" {
 22.                 estadd scalar `dwell'_change = brands_`num'_`dwell'_share[
> 40] - ``dwell'_2019'
 23.         }
 24.         estadd scalar projected_prod =  100*brands_`num'_diff[40]
 25.         
.         frame change default    
 26. }

added scalar:
e(dwell_0_to_10_change) =  .08105503

added scalar:
e(dwell_11_to_20_change) =  -.02310383

added scalar:
e(dwell_21_to_60_change) =  -.04482081

added scalar:
e(dwell_61_to_240_change) =  -.01313038

added scalar:
     e(projected_prod) =  2.8242188

added scalar:
e(dwell_0_to_10_change) =  .09883659

added scalar:
e(dwell_11_to_20_change) =  -.0129367

added scalar:
e(dwell_21_to_60_change) =  -.06253728

added scalar:
e(dwell_61_to_240_change) =  -.0233626

added scalar:
     e(projected_prod) =  18.190575

added scalar:
e(dwell_0_to_10_change) =  .08814804

added scalar:
e(dwell_11_to_20_change) =  .00443633

added scalar:
e(dwell_21_to_60_change) =  -.07971024

added scalar:
e(dwell_61_to_240_change) =  -.01287411

added scalar:
     e(projected_prod) =  6.0418673

added scalar:
e(dwell_0_to_10_change) =  .10378881

added scalar:
e(dwell_11_to_20_change) =  -.02704672

added scalar:
e(dwell_21_to_60_change) =  -.06474116

added scalar:
e(dwell_61_to_240_change) =  -.01200096

added scalar:
     e(projected_prod) =  9.7570583

added scalar:
e(dwell_0_to_10_change) =  .12116447

added scalar:
e(dwell_11_to_20_change) =  -.01913994

added scalar:
e(dwell_21_to_60_change) =  -.0861452

added scalar:
e(dwell_61_to_240_change) =  -.01587935

added scalar:
     e(projected_prod) =  15.603283

added scalar:
e(dwell_0_to_10_change) =  .11575441

added scalar:
e(dwell_11_to_20_change) =  -.02560107

added scalar:
e(dwell_21_to_60_change) =  -.07132115

added scalar:
e(dwell_61_to_240_change) =  -.01883219

added scalar:
     e(projected_prod) =  15.111998

. 
. **** Graph Figure A6
. frame new {
.         
.         foreach num of numlist 1/6 {
  2.                 label var brands_`num'_diff "`reg_title_`num''"
  3.         }
.         gen high = 0.5
.         gen low = -0.1
.         
.         label var year_month_gs "Year-Month"
.         graph twoway rarea high low year_month_gs if year_month_gs >= 748, lc
> olor(gs14%0) fcolor(gs14%50) || line brands_1_diff brands_2_diff brands_3_dif
> f brands_4_diff brands_5_diff brands_6_diff year_month_gs if year_month_gs <=
> 747, lcolor(black stc1 stc2 stc3 stc4 stc5) lwidth(thick) || line brands_1_di
> ff brands_2_diff brands_3_diff brands_4_diff brands_5_diff brands_6_diff year
> _month_gs if year_month_gs >=748, lcolor(black stc1 stc2 stc3 stc4 stc5) lwid
> th(thick) yline(0, lcolor(black) lwidth(thin)) title("") ylabel(-0.1(0.1)0.5,
>  format(%3.1fc)) ytitle("Productivity Difference, Log Scale") legend(order(6 
> 7 3 5 4 2)) 
.         graph export "${export_root}/figure_A6.pdf", replace
file
    /project/fagoolsb/service_industries/replication_package/exhibits/figure_
    > A6.pdf saved as PDF format
. }

. 
end of do-file


. 